package springtest.nettySocketio.listener;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

import com.corundumstudio.socketio.SocketIOServer;

/**
 * @author chenzhiqiang
 * @date 2018-07-03 15:45:56
 */
@Configuration
@AutoConfigureAfter(StartListener.class)
public class StartSocketIOServer implements CommandLineRunner {

    @Autowired
    private SocketIOServer socketIoServer;
    @Autowired
    private StartListener startListener;
    @Autowired
    private SendDateListener sendDateListener;

    @Order(1)
    public void run(String... args) throws Exception {
        socketIoServer.addConnectListener(startListener);
        // socketIoServer.addEventListener("testSocket", User.class,
        // sendDateListener);
        socketIoServer.start();
        System.out.println("soket服务启动");
    }

}
